def toStr(n, base):
    '''
    将一个整数转换为任意数制(二, 八, 十, 十六)的字符串
    '''
    conversionString="0123456789ABCDEF"
    if n < base:
        return conversionString[n]
    else:
        return toStr(n//base, base) + conversionString[n % base]

print(toStr(7,2))